<div id="content">
  <div class="row s_page_title">
    <sa-big-breadcrumbs
      [items]="['系统基础管理', '公司管理', '公司信息管理']"
      icon="fa fa-list"
      class="col-xs-12 col-sm-7 col-md-7 col-lg-4"
    ></sa-big-breadcrumbs>
  </div>
  <sa-widgets-grid>
    <div class="s_table">
      <div sa-widget [editbutton]="false" color="darken" class="clearfix">
        <header>
          <span class="widget-icon"><i class="fa fa-table"></i></span>
          <h2>公司信息管理</h2>
        </header>
        <div>
          <div class="widget-body no-padding">
            <div class="page-header clearfix s_table_opreation">
              <div class="left page-header-btn">
                <div class="selectDate top_module">
                  <table-select-date
                    [notInit]="true"
                    (outerTime)="getSelectTableTime($event)"
                    [specifyTime]="initDateRange"
                  ></table-select-date>
                </div>
                <div class="top_module top_module_box">
                  <span class="top_module_label module_text">行业类型</span>
                  <select
                    name=""
                    class="top_module_select"
                    [(ngModel)]="businessType"
                    (change)="businessTypeChange($event.target.value)"
                  >
                    <option value="">请选择</option>
                    <option *ngFor="let item of businessTypeList" [value]="item.value">{{ item.label }}</option>
                  </select>
                </div>
                <button class="btn btn-primary" (click)="table_search()">查询</button>
                <button type="button" class="btn btn-primary" (click)="new_company('new')" *ngIf="companyAdd">
                  添加
                </button>
                <button class="btn btn-primary" type="button" (click)="exprotData()">导出</button>
              </div>
              <div class="right top-search">
                <input
                  type="text"
                  [(ngModel)]="searchKey"
                  (change)="table_search(searchKey)"
                  class="search-input"
                  placeholder="公司名称..."
                />
                <span class="top-search-box">
                  <button class="top-search-btn" type="button" (click)="table_search(searchKey)">
                    <i class="fa fa-search"></i>
                  </button>
                </span>
              </div>
            </div>
            <div class="table_scroll">
              <table
                class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table"
              >
                <thead>
                  <tr>
                    <th>编号</th>
                    <th>公司名称</th>
                    <th>父级公司</th>
                    <th>项目名称</th>
                    <th>签单单位</th>
                    <th>行业类型</th>
                    <th>销售归属</th>
                    <th>首次安装(服)</th>
                    <th>首次安装(保)</th>
                    <!-- <th>次年续费(服)</th>
                    <th>次年续费(保)</th> -->
                    <th>省份</th>
                    <th>城市</th>
                    <th>市区</th>
                    <th>地址</th>
                    <th>电话</th>
                    <th>映射编码</th>
                    <th>备注</th>
                    <th>坐标</th>
                    <th *ngIf="companyEdit || companyDeleteBatch">操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr *ngFor="let row of tableData">
                    <td>{{ row.id }}</td>
                    <td>{{ row.companyName }}</td>
                    <td>
                      <span *ngIf="!row.parentName">#</span>
                      <span *ngIf="row.parentName">{{ row.parentName }}</span>
                    </td>
                    <td>{{ row.projectName }}</td>
                    <!--签单单位-->
                    <td>{{ row.signUnit }}</td>
                    <td>{{ getBusinessTypeText(row.businessType) }}</td>
                    <td>{{ row.saleAscription }}</td>
                    <td>{{ row.firstRenewalCycle ? row.firstRenewalCycle + '个月' : '--' }}</td>
                    <td>{{ row.firstWarrantyCycle ? row.firstWarrantyCycle + '个月' : '--' }}</td>
                    <!-- <td>{{ row.isEnable == 1 ? row.renewalCycle + '个月' : '--' }}</td>
                    <td>{{ row.isEnable == 1 ? row.warrantyCycle + '个月' : '--' }}</td> -->
                    <td>
                      <span *ngIf="row.addressEntity">{{ row.addressEntity.provinceName }}</span>
                    </td>
                    <td>
                      <span *ngIf="row.addressEntity">{{ row.addressEntity.cityName }}</span>
                    </td>
                    <td>
                      <span *ngIf="row.addressEntity">{{ row.addressEntity.townName }}</span>
                    </td>
                    <td>{{ row.address }}</td>
                    <td>{{ row.tel }}</td>
                    <!-- 映射编码 -->
                    <td>{{ row.mappingCode }}</td>
                    <!--备注-->
                    <td>{{ row.remark }}</td>
                    <!--坐标-->
                    <td>
                      <span *ngIf="row.lng && row.lat">{{ row.lng }}，{{ row.lat }}</span>
                    </td>
                    <td *ngIf="companyEdit || companyDeleteBatch">
                      <button type="button" (click)="updata_company(row)" *ngIf="companyEdit">编辑</button>
                      <button type="button" (click)="del_company(row)" *ngIf="companyDeleteBatch">删除</button>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="table-fix clearfix">
              <paginator
                [totalRecords]="totalCount"
                [rows]="pageSize"
                [currentPage]="curPage - 1"
                (onPageChange)="paginate($event)"
              ></paginator>
              <button type="button" class="btn default refresh_btn" (click)="refresh()">
                <i class="fa fa-refresh"></i>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </sa-widgets-grid>
</div>
